<?php

namespace App\Http\Controllers\Service;

use App\Entity\Category;
use App\Http\Controllers\Controller;
use App\Models\M3Result;

class BookController extends  Controller
{
    public function getCategoryByParentId($parentId)
    {
        $categoryList = Category::query()->where('parent_id', $parentId)->get();

        $m3Result = new M3Result();
        $m3Result->status = 0;
        $m3Result->message = '返回成功';
        $m3Result->categorys = $categoryList;

        return $m3Result->toJson();
    }
}
